package org.sang.mapper;

import org.apache.ibatis.annotations.Param;
import org.sang.bean.User;
import org.sang.bean.Role;

import java.util.Date;
import java.util.List;

/**
 * Created by daigb on 2018/02/01.
 */
public interface UserMapper {
    User loadUserByUsername(String username);

    List<Role> getRolesByUserId(Long id);

    Long userReg(User user);

    List<User> getUsersByKeywords(@Param("keywords") String keywords);

    int updateUser(User user);

    int deleteRoleByUserId(Long userId);

    int addRolesForUser(@Param("userId") Long userId, @Param("rids") Long[] rids);

    User getUserById(Long userId);

    int deleteUser(Long userId);

    List<User> getUserByPage(@Param("start") Integer start, @Param("size") Integer size, @Param("keywords") String keywords, @Param("company") String company, @Param("startBeginDate") Date startBeginDate, @Param("endBeginDate") Date endBeginDate);

    Long getCountByKeywords(@Param("keywords") String keywords, @Param("company") String company, @Param("startBeginDate") Date startBeginDate, @Param("endBeginDate") Date endBeginDate);

}
